using System.Windows;
using System.Windows.Markup;
using Common;
using Common.Enum;
using SSettings;

namespace MainView.Windows
{
	public partial class ExperimentSettingWindow : Window, IComponentConnector
	{
		public ExperimentSettingWindow()
		{
			InitializeComponent();
		}

		public void viewConfig(ExperimentSetting ExperimentSetting, EProjectType type)
		{
			if (ExperimentSetting != null)
			{
				base.DataContext = ExperimentSetting;
				GrooupBox_peak_curve.Visibility = ((type != EProjectType.HRM && type != EProjectType.Melt) ? Visibility.Collapsed : Visibility.Visible);
				GrooupBox_show_as_gray_point.Visibility = ((type != EProjectType.AD) ? Visibility.Collapsed : Visibility.Visible);
				if (ConfigReader.GetInstance().GetSubsetConfigFromIni() == 0)
				{
					use_subset.Visibility = Visibility.Collapsed;
					Thickness margin = display_paramter.Margin;
					margin.Top -= 30.0;
					display_paramter.Margin = margin;
				}
			}
		}

		private void btnCancel_Click(object sender, RoutedEventArgs e)
		{
			Close();
		}

		private void btnOK_Click(object sender, RoutedEventArgs e)
		{
			base.DialogResult = true;
			Close();
		}

		private void reset_Click(object sender, RoutedEventArgs e)
		{
			((ExperimentSetting)base.DataContext).ReSet();
		}
	}
}
